package com.vince.hulk.menu
{
import assets.bg.ContinueBgAsset;
import assets.bg.NewGameBgAsset;

import com.vince.hulk.states.LevelState1;
import com.vince.hulk.states.PlayState;

import org.flixel.FlxButton;
import org.flixel.FlxG;
import org.flixel.FlxSprite;
import org.flixel.FlxState;

/**
 * author yangwz
 */		
public class SplashScreen extends FlxState
{
	//==========================================================================
	//  Constructor
	//==========================================================================
	/**
	 * Constructs a new <code>SplashScreen</code> instance.
	 * 
	 */
	public function SplashScreen()
	{
		super();
		initDisplay();
	}
	//==========================================================================
	//  Variables
	//==========================================================================
	[Embed(source = "assets/NewGame.png")]
	private var newGameBgAsset:Class;
	
	[Embed(source = "assets/Continue.png")]
	private var continueBgAsset:Class;
	//==========================================================================
	//  Methods
	//==========================================================================
	private function initDisplay():void
	{
	}
	
	/**
	 * @inheritDoc
	 */
	override public function create():void
	{
		super.create();
		var newGameBg:FlxSprite = new FlxSprite(0, 0, newGameBgAsset);
		add(newGameBg);
	}
	
	override public function update():void
	{
		if (FlxG.keys.SPACE)
		{
			if (getLevel(FlxG.level))
			{
				FlxG.switchState(getLevel(FlxG.level));
			}
			else
			{
				FlxG.switchState(getLevel(1));
			}
			trace("ok");
			this.kill();
		}
	}
	
	public function getLevel(level:int):PlayState
	{
		switch(level)
		{
			case 1:
			{
				return new LevelState1();
				break;
			}
			default:
			{
				return null;
				break;
			}
		}
	}
}
}